package br.com.fiap.agenteDialogo.BLL;

import javax.swing.JOptionPane;

import org.apache.commons.collections15.Factory;
import br.com.fiap.agenteDialogo.Beans.Vertex;

public class VertexFactory implements Factory<Vertex> {
	
	public VertexFactory()
	{
		
	}
	
	public VertexFactory(String nome)
	{
		
	}
	
	private int n = 1;
	
	

	public Vertex edit() {
		return null;
	}
	
	@Override
	public Vertex create() {
		
		Vertex v = new Vertex(n++);
		
		String value = JOptionPane.showInputDialog(null, "Entre com o nome do Vertex: ", "GraphEditor", 1);
		
		if(value.equals(null) || value.equals(""))
			value = "Vertex - " + v.getID();
		
		v.setValue(value);
		
		return (v);
	}
}
